package com.jvtd.demo.alertDialog;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jvtd.demo.R;
import com.jvtd.demo.recyclerView.DemoRecyclerView;
import com.jvtd.demo.recyclerView.RvBean;
import com.jvtd.widget.dialog.JvtdAlertDialog;
import com.jvtd.widget.emptyView.JvtdEmptyView;
import com.jvtd.widget.toast.JvtdToast;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class AlertDialogActivity extends AppCompatActivity implements JvtdAlertDialog.OnClickListener {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_alert_dialog);
        TextView ad1Btn = findViewById(R.id.alertdialog_1);
        TextView ad2Btn = findViewById(R.id.alertdialog_2);
        TextView ad3Btn = findViewById(R.id.alertdialog_3);

        ad2Btn.setOnClickListener(view -> showTips());
        ad1Btn.setOnClickListener(view -> showInput());
        ad3Btn.setOnClickListener(view -> showNoInfo());
    }

    private void showNoInfo() {
        JvtdAlertDialog alertDialog = new JvtdAlertDialog();
        alertDialog.setTitle("提示").setShowContentLayout(false).setOnClickListener(this).show(getSupportFragmentManager());
    }

    private void showInput() {
        JvtdAlertDialog alertDialog = new JvtdAlertDialog();
        alertDialog.setTitle("提示").setMessage("提示信息").setCenterBtnText("中间").setOnClickListener(this).show(getSupportFragmentManager());
    }

    private void showTips() {
        JvtdAlertDialog alertDialog = new JvtdAlertDialog();
        alertDialog.setTitle("提示").setEdit(true).setEditHint("输入信息")
                .setEditMaxNum(6).setEditEmptyText("空").setOnClickListener(this).show(getSupportFragmentManager());
    }

    @Override
    public void onClick(@JvtdAlertDialog.DialogBtn int pos, String inputText) {
        if (pos != JvtdAlertDialog.RIGHT) return;
        JvtdToast.makeText(this,inputText,Toast.LENGTH_SHORT).show();
    }
}

